use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use chrono::{DateTime, Utc};

#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum DataType {
    MarketData,
    TechnicalIndicator,
    PredictionResult,
    ModelParams,
    Error,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MarketData {
    pub timestamp: DateTime<Utc>,
    pub symbol: String,
    pub open: f64,
    pub high: f64,
    pub low: f64,
    pub close: f64,
    pub volume: f64,
    pub amount: f64,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TechnicalIndicator {
    pub timestamp: DateTime<Utc>,
    pub symbol: String,
    pub indicator_name: String,
    pub values: HashMap<String, f64>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PredictionResult {
    pub timestamp: DateTime<Utc>,
    pub symbol: String,
    pub target_time: DateTime<Utc>,
    pub predicted_price: f64,
    pub confidence: f64,
    pub prediction_interval: (f64, f64),
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BridgeError {
    pub error_code: i32,
    pub error_type: String,
    pub message: String,
    pub details: Option<HashMap<String, String>>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ArrowData<T> {
    pub data: T,
    pub metadata: HashMap<String, String>,
}

use arrow::record_batch::RecordBatch;

pub type ArrowTable = RecordBatch;